<?php

class admin_model_system_menu_group extends model
{

	// 获取菜单组列表
	public function get_groups()
	{
		$db = bone::get_db();
		return $db->get_objs( 'SELECT * FROM `bone_system_menu_group` ORDER BY `id` ASC' );
	}

	// 获取菜单组中总数
	public function get_group_sum()
	{
		$db = bone::get_db();
		return $db->get_result( 'SELECT COUNT(*) FROM `bone_system_menu_group`' );
	}
	

	//删除菜单组
	public function delete_group( $group_id )
	{
		$db = bone::get_db();
		$db->execute( 'DELETE FROM `bone_system_menu` WHERE `group_id`='.$group_id );

		$group = bone::get_table('system', 'menu_group');
		$group->load( $group_id );

		unlink( BONE_ROOT.DS.'menus'.DS.$group->class_name.'.php' );

		$group->delete();
	}

}
?>